#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N = 5e5 +10;
int a[N];
void solve()
{
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) cin >>  a[i];
    sort(a+1,a+n+1);
    for(int i = 2; i <= n - 1; i++)
    {
        if((a[i] * a[i-1] >= a[i] * a[i+1])) 
        {
            cout << "NO" <<endl;
            return; 
        }
    }
    cout << "YES" << endl;
    for(int i = 1; i <= n; i++) cout << a[i] << " " ;
    cout << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t = 1;
    while(t--) solve();
    return 0;
}